import axios from "axios";


export const serverUrl = "http://localhost:11219";

const instance = axios.create({
  baseURL: serverUrl,
  timeout: 10000,
});


/**
 * 发起一个get请求
 * @param {*} url
 * @param {*} params
 * @returns
 */
export const get = (url, params) => instance.get(url, { params });

/**
 * 发起一个post请求
 * @param {*} url
 * @param {*} data
 * @returns
 */
export const post = (url, data) => instance.post(url, data);

/**
 * 发起一个put请求
 * @param {*} url
 * @param {*} data
 * @returns
 */
export const put = (url, data) => instance.put(url, data);

/**
 * 发起一个delete请求
 * @param {*} url
 * @returns
 */
export const del = (url) => instance.delete(url);
